<script>
import authManager from '@/utils/auth.js'
import cartManager from '@/utils/cart.js'
	export default {
		onLaunch: function() {
			console.log('App Launch')
			
            if (authManager.isLoggedIn()) {
                console.log('获取到token，前往验证')
                // token验证函数
            } else {
                console.log('未获取到token')
				uni.navigateTo({
					url: '/pages/login/index'
				})
            }
		},
		onShow: function() {
			console.log('App Show')
			// 初始化购物车列表
			if (authManager.isLoggedIn()) {
				cartManager.onUserLogin()
            }
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	/* #ifndef APP-NVUE */
	// 设置整个项目的背景色
	page {
		background-color: #fff;
	}

	/* #endif */
</style>
